package io.r2mo.test.common.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.r2mo.dbe.mybatisplus.core.domain.BaseEntity;
import io.r2mo.dbe.mybatisplus.core.typehandler.TypedUUIDHandler;
import io.r2mo.test.common.enums.ProductCatType;
import io.r2mo.typed.annotation.Identifiers;
import io.r2mo.typed.constant.DefaultConstantValue;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.UUID;

/**
 * @author lang : 2025-09-03
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("tk_product_cat")
@Identifiers({"name"})
@Schema(name = "商品分类")
public class ProductCatEntity extends BaseEntity {

    private String name;

    private ProductCatType type;

    @TableField(jdbcType = JdbcType.CLOB)
    private String description;

    private String icon;

    private int sort;

    private BigDecimal amountMarket;

    @DateTimeFormat(pattern = DefaultConstantValue.DEFAULT_META_DATETIME_PATTERN)
    private LocalDateTime publishAt;

    @TableField(typeHandler = TypedUUIDHandler.class)
    private UUID parentId;
}
